home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / Prograph Classic 2.6.1 / Prograph Reference Manual / Prograph Reference 5-7 / Prograph Reference 5-7.rsrc / TEXT_168.txt < prev    next >
Encoding:
Text File  |  1995-10-25  |  11.9 KB  |  430 lines

  1.  
  2.  Memory
  3.  
  4. Refer to appendix II, ‚ÄúC Code Usage,‚Äù for a discussion of Prograph data types and of the type macintosh.  Types ABlock, ABlock@, and ABlock@@ are Mac types corresponding to a buffer, pointer to a buffer, and handle to a buffer, respectively. Many of the primitives in this category accept inputs that are direct, indirect (pointer), and doubly indirect (handle) references, and in fact also convert integers to pointers where appropriate. The Gets (such as get-integer) and Puts (such as put-real) output an incremental offset (original offset + size of data), to ensure proper positioning for the next Get or Put. In general, these primitives provide ways to manipulate heterogeneous data (obtained by reading from a file, for example) in memory buffers.
  5.  
  6.  
  7. _________________________________________________
  8.  
  9.                                       address-to-object     *313*
  10.  
  11.  
  12. Input types: integer; [ boolean ]
  13.  
  14. Output types: any
  15.  
  16. Description: Object is the Prograph Object at the specified Address. Address must have been generated by a call to object-to-address on the same machine (same address space), and you must be certain that the object still exists at that address.  Release? is FALSE by default. If Release?, then Address is not valid.
  17.  
  18. See also:     object-to-address
  19.  
  20.  
  21. _________________________________________________
  22.  
  23.                                            block-address    *313*
  24.  
  25.  
  26.  
  27. Input types: ABlock
  28.  
  29. Output types: integer
  30.  
  31. Description:     Address is the address of the first character in Block. Block should be locked whenever Address is taken or used.
  32.  
  33. See also:  string-address
  34.  
  35.  
  36. _________________________________________________
  37.  
  38.                                           block-size     *314*
  39.  
  40.  
  41. Input types: macintosh
  42.  
  43. Output types: integer
  44.  
  45. Description:     Size is the value of the size field of Mac.
  46.  
  47. See also:  new-block
  48.  
  49.  
  50. _________________________________________________
  51. ¬†                                           compact-memory     *314*
  52.  
  53. Description:    Compacts memory. Use this primitive if you are using Macintosh methods which require a lot of memory.
  54.  
  55.  
  56. _________________________________________________
  57.  
  58.                                      from-handle    *314*
  59.  
  60.  
  61. Input types: macintosh
  62.  
  63. Output types: integer
  64.  
  65. Description:     Mac must be a handle to a Macintosh structure, and Address is the address of the handle‚Äôs master pointer.
  66.  
  67. See also:  to-handle, to-pointer, from-pointer
  68.  
  69.  
  70. _________________________________________________
  71.  
  72.                                       from-pointer    *314*
  73.  
  74.  
  75. Input types: macintosh
  76.  
  77. Output types: integer
  78.  
  79. Description:     Mac must be a pointer to a Macintosh structure, and Address is the address of that structure.
  80.  
  81. See also:  to-pointer, to-handle, from-handle
  82.  
  83.  
  84. _________________________________________________
  85.  
  86.                                                get-integer      *315*
  87.  
  88.  
  89.  
  90. Input types: ABlock[@[@]] | integer;  integer;  integer
  91.  
  92. Output types: ABlock[@[@]] | integer;  integer;  integer
  93.  
  94. Description:     Value is an integer of length Size bytes, read from Buffer starting at Offset bytes. Size must be 1, 2, or 4. NextOffset is Offset + Size.
  95.  
  96. See also:  put-integer, get-point, get-real, get-rect, get-string, get-text, sign-extend
  97.  
  98.  
  99. _________________________________________________
  100.  
  101.                                                    get-point      *315*
  102.  
  103.  
  104.  
  105. Input types: ABlock[@[@]] | integer;  integer
  106.  
  107. Output types: ABlock[@[@]] | integer;  integer;  Point
  108.  
  109. Description:     aPoint is a point obtained by reading four bytes from Buffer starting at Offset bytes. NextOffset is Offset + 4.
  110.  
  111. See also:  put-point, get-integer, get-real, get-rect, get-string, get-text
  112.  
  113.  
  114. _________________________________________________
  115.  
  116.                                                   get-real      *315*
  117.  
  118.  
  119.  
  120. Input types: ABlock[@[@]] | integer;  integer
  121.  
  122. Output types: ABlock[@[@]] | integer;  integer;  real
  123.  
  124. Description:     Value is a real of length Size bytes, read from Buffer starting at Offset bytes. Size must be be 4, 8, or 10. NextOffset is Offset + Size.
  125.  
  126. See also:  put-real, get-integer, get-point, get-rect, get-string, get-text
  127.  
  128.  
  129. _________________________________________________
  130.  
  131.                                            get-rect      *316*
  132.  
  133.  
  134.  
  135. Input types: ABlock[@[@]] | integer;  integer
  136.  
  137. Output types: ABlock[@[@]] | integer;  integer;  Rect
  138.  
  139. Description:     aRect is a rectangle obtained by reading eight bytes from Buffer starting at Offset bytes. NextOffset is Offset + 8.
  140.  
  141. See also:  put-rect, get-integer, get-point, get-real, get-string, get-text
  142.  
  143.  
  144. _________________________________________________
  145.  
  146.                                             get-string      *316*
  147.  
  148.  
  149.  
  150. Input types: ABlock[@[@]] | integer;  integer
  151.  
  152. Output types: ABlock[@[@]] | integer;  integer;  string
  153.  
  154. Description:     aString is a string of length N bytes, where N is the one-byte integer read from Buffer starting at Offset, and the N bytes of aString are read from Buffer starting at Offset+1. NextOffset is Offset+N+1.
  155.  
  156. See also:  put-string, get-integer, get-point, get-real, get-rect, get-text
  157.  
  158.  
  159.  
  160. _________________________________________________
  161.  
  162.                                            get-text      *316*
  163.  
  164.  
  165.  
  166. Input types: ABlock[@[@]] | integer;  integer;  integer
  167.  
  168. Output types: ABlock[@[@]] | integer;  integer;  string
  169.  
  170. Description:     aString is a string of length Size bytes, read from Buffer starting at Offset bytes. Size must be greater than or equal to 0 and less than or equal to 65535. NextOffset is Offset + Size.
  171.  
  172. See also:  put-text, get-integer, get-point, get-real, get-rect, get-string
  173.  
  174.  
  175. _________________________________________________
  176.  
  177.                                 lock-block     *317*
  178.  
  179.  
  180. Input types: ABlock
  181.  
  182. Description:     Locks the handle containing Block.
  183.  
  184. See also:  unlock-block
  185.  
  186.  
  187. _________________________________________________
  188.  
  189.                                lock-string      *317*
  190.  
  191.  
  192. Input types: string
  193.  
  194. Description:     Locks the handle containing aString.
  195.  
  196. See also:  unlock-string
  197.  
  198.  
  199. _________________________________________________
  200.  
  201.                                     make-direct     *317*
  202.  
  203.  
  204. Input names: Type; Size 
  205.  
  206. Input types: string; integer 
  207.  
  208. Output types: external
  209.  
  210. Description: Block is an external structure block of size Size and type Type. Type can be any name listed under External Structures in the Info window. 
  211.  
  212. See also: make-handle, make-pointer
  213.  
  214.  
  215. _________________________________________________
  216.  
  217.                                                        make-handle    *317*
  218.  
  219.  
  220. Input names: Type; Size
  221.  
  222.  Input types: string; integer 
  223.  
  224. Output types: external@@
  225.  
  226. Description: Handle is a handle to a structure of size Size and type Type. Type can be any name listed under External Structures in the Info window. The user must use the Mac Toolbox call DisposHandle to free the memory allocated to the handle.
  227.  
  228. See also: make-direct, make-pointer
  229.  
  230.  
  231. _________________________________________________
  232.  
  233.  
  234.  
  235.                                                         make-pointer    *318*
  236.  
  237.  
  238. Input names: Type; Size 
  239.  
  240. Input types: string; integer 
  241.  
  242. Output types: external@
  243.  
  244. Description: Pointer is a pointer to a structure of size Size and type Type. Type can be any name listed under External Structures in the Info window. The user must use the Mac Toolbox call DisposPtr to free the memory allocated to the pointer.
  245.  
  246. See also: make-direct, make-handle
  247.  
  248.  
  249. _________________________________________________
  250.  
  251.                                new-block      *318*
  252.  
  253.  
  254. Input types: integer
  255.  
  256. Output types: ABlock
  257.  
  258. Description:     Block is a new block of Size bytes.
  259.  
  260. See also:  block-size
  261.  
  262.  
  263. _________________________________________________
  264.  
  265.                                                object-to-address    *319*
  266.  
  267.  
  268.  
  269. Input types: any; [ boolean ]
  270.  
  271. Output types: integer
  272.  
  273. Description: Address is the address of any Prograph object. Keep? is FALSE by default.  If TRUE, then Address is always valid and the Object is not deleted.  To recover memory in this case, address-to-object must be TRUE.
  274.  
  275. See also: address-to-object
  276.  
  277.  
  278. _________________________________________________
  279.  
  280.                                                                       put-integer      *319*
  281.  
  282.  
  283.  
  284. Input types: ABlock[@[@]] | integer;  integer;  integer;  integer
  285.  
  286. Output types: ABlock[@[@]] | integer;  integer
  287.  
  288. Description:     Value is converted into an integer of Size bytes, which is then put into Buffer starting at Offset. Size must be 1, 2, or 4. NextOffset is Offset + Size.
  289.  
  290. See also:  get-integer, put-point, put-real, put-rect, put-string, put-text
  291.  
  292.  
  293. _________________________________________________
  294.  
  295.                                                   put-point      *319*
  296.  
  297.  
  298.  
  299. Input types: ABlock[@[@]] | integer;  integer;  Point
  300.  
  301. Output types: ABlock[@[@]] | integer;  integer  
  302.  
  303. Description:     The four bytes of aPoint are put into Buffer at Offset. NextOffset is Offset + 4.
  304.  
  305. See also:  get-point, put-integer, put-real, put-rect, put-string, put-text
  306.  
  307.  
  308. _________________________________________________
  309.  
  310.                                                                    put-real      *320*
  311.  
  312.  
  313. Input types: ABlock[@[@]] | integer;  integer;  integer;  real
  314.  
  315. Output types: ABlock[@[@]] | integer;  integer
  316.  
  317. Description:     Converts value into a floating point value of Size bytes, which is then put into Buffer starting at Offset. Size must be 4, 8, or 10. NextOffset is Offset + Size.
  318.  
  319. See also:  get-real, put-integer, put-point, put-rect, put-string, put-text
  320.  
  321.  
  322. _________________________________________________
  323.  
  324.                                                       put-rect      *320*
  325.  
  326.  
  327. Input types: ABlock[@[@]] | integer;  integer;  Rect
  328.  
  329. Output types: ABlock[@[@]] | integer;  integer
  330.  
  331. Description:     Puts 8 bytes of aRect into Buffer at Offset. NextOffset is Offset + 8.
  332. See also:  get-rect, put-integer, put-point, put-real, put-string, put-text
  333.  
  334.  
  335. _________________________________________________
  336.  
  337.                                                   put-string      *320*
  338.  
  339.  
  340. Input types: ABlock[@[@]] | integer;  integer;  string
  341.  
  342. Output types: ABlock[@[@]] | integer;  integer
  343.  
  344. Description:     Puts N+1 bytes into Buffer starting at Offset, where N is the mimimum of 255 and the length of aString. First byte is N; the remaining N bytes are from aString. NextOffset is Offset+N+1.
  345.  
  346. See also:  get-string, put-integer, put-point, put-real, put-rect, put-text
  347.  
  348.  
  349. _________________________________________________
  350.  
  351.                                                                    put-text      *321*
  352.  
  353.  
  354.  
  355. Input types: ABlock[@[@]] | integer;  integer; integer;  string
  356.  
  357. Output types: ABlock[@[@]] | integer;  integer
  358.  
  359. Description:     Puts Size bytes from aString into Buffer starting at Offset. Size must be greater than or equal to 0 and less than or equal to 65535. NextOffset is Offset+Size.
  360.  
  361. See also:  get-text, put-integer, put-point, put-real, put-rect, put-string
  362.  
  363.  
  364. _________________________________________________
  365.  
  366.                                         string-address    *321*
  367.  
  368.  
  369.  
  370. Input types: string
  371.  
  372. Output types: integer
  373.  
  374. Description:     Address is the address of the first character in aString. aString should be locked whenever Address is taken or used.
  375.  
  376. See also:  block-address
  377.  
  378.  
  379. _________________________________________________
  380.  
  381.                              to-handle     *321*
  382.  
  383.  
  384. Input types: integer
  385.  
  386. Output types: macintosh
  387.  
  388. Description:     Address is the address of a master pointer to a Macintosh structure, and Mac is a handle to that structure.
  389.  
  390. See also:  from-handle, to-pointer, from-pointer
  391.  
  392.  
  393. _________________________________________________
  394.  
  395.                                 to-pointer     *322*
  396.  
  397.  
  398. Input types: integer
  399.  
  400. Output types: macintosh
  401.  
  402. Description:     Address is the address of a Macintosh structure, and Mac is a pointer to that structure.
  403.  
  404. See also:  from-pointer, to-handle, from-handle 
  405.  
  406.  
  407. _________________________________________________
  408.  
  409.                                     unlock-block     *322*
  410.  
  411.  
  412. Input types: ABlock
  413.  
  414. Description:     Unlocks the handle containing Block.
  415.  
  416. See also:  lock-block
  417.  
  418.  
  419. _________________________________________________
  420.  
  421.                                     unlock-string     *322*
  422.  
  423.  
  424. Input types: string
  425.  
  426. Description:     Unlocks the handle containing aString.
  427.  
  428. See also:  lock-string
  429.  
  430.